<template>
	<view>
		<u-tabbar
				:value="tabBarIndex"
				:fixed="true"
				:placeholder="true"
				:safeAreaInsetBottom="true"
				:border="false"
				activeColor="#6072FF" inactiveColor="#0000007F"
		>
			<u-tabbar-item :name="item.index" :text="item.title" v-for="(item,index) in tabBarList" :key="index"
						   @click="changeTabBar(item.index,item.title)">
				<image
						class="u-page__item__slot-icon"
						slot="active-icon"
						:src="staticFileUrl + item.activeIconUrl"
				></image>
				<image
						class="u-page__item__slot-icon"
						slot="inactive-icon"
						:src="staticFileUrl + item.inactiveIconUrl"
				></image>
			</u-tabbar-item>
		</u-tabbar>
	</view>
</template>

<script>
	export default {
		name:"tabar-stats",
		data() {
			return {
				staticFileUrl: this.$configPath.staticFileUrl,
				tabBarList: [
					{
						index: 0,
						title: '经营数据',
						activeIconUrl: '/image/tabbar-stats/stats-data-select.png',
						inactiveIconUrl: '/image/tabbar-stats/stats-data.png',
						pageUrl: '/pages-other/operation-stats/operation-stats',
					},
					{
						index: 1,
						title: '设备报表',
						activeIconUrl: '/image/tabbar-stats/device-stats-select.png',
						inactiveIconUrl: '/image/tabbar-stats/device-stats.png',
						pageUrl: '/pages-other/operation-stats/device-stats/device-stats',
					},
					{
						index: 2,
						title: '每日报表',
						activeIconUrl: '/image/tabbar-stats/day-stats-select.png',
						inactiveIconUrl: '/image/tabbar-stats/day-stats.png',
						pageUrl: '/pages-other/operation-stats/day-stats/day-stats',
					},
					{
					 index: 3,
						title: '每月报表',
						activeIconUrl: '/image/tabbar-stats/month-stats-select.png',
						inactiveIconUrl: '/image/tabbar-stats/month-stats.png',
						pageUrl: '/pages-other/operation-stats/month-stats/month-stats',
					},
				],
				tabBarIndex: 0,
			};
		},
		methods: {
			Load(){
				const menu = this.tabBarList[this.tabBarIndex];
				this.changeTabBar(this.tabBarIndex,menu.title);
			},
			changeTabBar(e,t){
				this.tabBarIndex = e;
				uni.$emit("tabbarStats", {msg:'66', index: e})
				uni.setNavigationBarTitle({
					title: t
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
.u-page__item__slot-icon{
	width: 40rpx;
	height: 40rpx;
}
</style>
